package cn.itcast.com.day02;

public class test01 {
    //使用两个标记
    //使用一个新数组
    public static void main(String[] args) {
        int[] a = {1,1,3,4,5,5,6,6,6,7};
        int length = a.length;
        int b[] = new int[length];
        b[0]=a[0];
        int q = 0;
        for (int i = 1; i < length; i++) {
            if(b[q]!=a[i]){
                q++;
                b[q]=a[i];
            }
        }
        System.out.println(q+1);
        for (int i = 0; i < q+1; i++) {
            System.out.println(b[i]);
        }
    }
}
